<?php
namespace backend\service;

use backend\components\WeChat;

class SendWechatMessage{

    /**
     * 用户提现成功发送消息
     * @param $openid
     * @param $formid
     * @param $amount
     * @param $result
     * @param $tip
     * @return mixed
     */
    public function income($openid, $formid, $amount, $result, $tip)
    {
        $msg = [
            "touser" => $openid,
            "template_id" => "mSkkGTGHz0fOoHlzxRYB0bAh-1DnZGWYLmgkTD_T6wg",
            "page" => "pages/index/index",
            "form_id" => $formid,
            "data" => [
                "keyword1" => [
                    "value" => (string)$amount,
                ],
                "keyword2" => [
                    "value" =>  $result,
                ],
                "keyword3" => [
                    "value" => $tip,
                ],
            ],
        ];

        $WeChat = new WeChat();
        return $WeChat->sendMsg($msg);
    }
}